package com.ycfmedical.bed.present;

import com.ycfmedical.bed.R;
import com.ycfmedical.bed.base.BaseHisFragment;
import com.ycfmedical.bed.bean.ImUser;
import com.ycfmedical.bed.local.DataManager;
import com.ycfmedical.bed.local.dao.HisSystemInfoDao;
import com.ycfmedical.bed.local.dao.UserDao;
import com.ycfmedical.bed.local.entity.HisSystemInfo;
import com.ycfmedical.bed.local.entity.User;
import com.ycfmedical.bed.utils.ResourceUtil;

import java.util.ArrayList;
import java.util.List;

import cn.droidlover.xdroidmvp.kit.Kits;
import cn.droidlover.xdroidmvp.mvp.XPresent;

/**
 * Created by Administrator on 2017/3/16 0016.
 */

public class HisPresenter extends XPresent<BaseHisFragment>
{
    // 从数据库获取数据
    public void loadData(final int page, int type)
    {
        List<HisSystemInfo> allHisInfoList = HisSystemInfoDao.getAllHisInfoList();
        List<HisSystemInfo> HisInfoList = new ArrayList<HisSystemInfo>();
        String s = allHisInfoList.toString();
        if (!Kits.Empty.check(allHisInfoList))
        {
            for (HisSystemInfo hisSystemInfo : allHisInfoList)
            {
                final long id = hisSystemInfo.getId();
                final long id1 = DataManager.getInstance().getUser().getId();
                if (hisSystemInfo.getId() == DataManager.getInstance().getUser().getId())
                {
                    // 取出数据
                    int userId = (int) id;
                    HisInfoList.add(hisSystemInfo);
                    getV().showData(HisInfoList);
                }

            }
        }
        else
        {
            // 当前数据库中不存在数据
        }
    }
}
